package com.sj.service.impl;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.sj.entity.Comment;
import com.sj.mapper.CommentMapper;
import com.sj.service.CommentService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * <p>
 * 评论表 服务实现类
 * </p>
 *
 * @author 孙峻
 * @since 2022-03-09
 */
@Service
public class CommentServiceImpl extends ServiceImpl<CommentMapper, Comment> implements CommentService {

    @Autowired
    private CommentMapper commentMapper;

    @Override
    public Long getSumCommentNum(Integer id, String type) {

        return commentMapper.getSumCommentNum(id, type);
    }

    @Override
    public IPage<Comment> getUserAnswer(IPage<Comment> answerPage, Integer id) {
        return commentMapper.getUserAnswer(answerPage, id);
    }

    @Override
    public Long getUserAnswerCount(Integer id) {
        return commentMapper.getUserAnswerCount(id);
    }

    @Override
    public IPage<Comment> getAdminCommentList(String type, IPage<Comment> page) {
        return commentMapper.getAdminCommentList(page, type);
    }
}
